home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 559 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is this ok: *pointer++ = value ??
  5. Date: Sun, 07 Jan 96 00:29:08 GMT
  6. Organization: none
  7. Message-ID: <820974548snz@genesis.demon.co.uk>
  8. References: <4cklvv$nmm@alcor.usc.edu> <4cmmcd$e3u@gryphon.phoenix.net>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4cmmcd$e3u@gryphon.phoenix.net>
  15.            brucew@phoenix.net "Bruce Wedding" writes:
  16.  
  17. >wawda@alcor.usc.edu (Abu Wawda) wrote:
  18. >
  19. >>       for (i=0; i<50; i++) *pointer++ = i;
  20. >
  21. >>My only problem is why? I mean you aren't allowed to do:
  22. >
  23. >>                 for (i=0; i<50; i++) p++ = i;
  24. >
  25. >Sure you can do that.  You are assigning addresses to the pointer.  It
  26. >probably isn't too smart, but it is legal.
  27.  
  28. No it isn't. p++ is not an lvalue in C and hence can't appear on the left
  29. of an assignment. *pointer++ is equivalent to *(pointer++) and is an lvalue
  30. and hence can appear on the left (as long as it is modifiable).
  31.  
  32. -- 
  33. -----------------------------------------
  34. Lawrence Kirby | fred@genesis.demon.co.uk
  35. Wilts, England | 70734.126@compuserve.com
  36. -----------------------------------------
  37.